@extends('layouts.admin_master')
@section('content')
    <style>
        [v-cloak] {
            display: none;
        }
    </style>
    <div class="card">
        <div class="card-header">
            <ul class="nav">
                <li class="nav-item">
                    <a href="{{route('goods.huopin.index',['goods'=>$goods])}}" class="nav-link">货品列表</a>
                </li>
                <li class="nav-item">
                    <a href="{{route('goods.huopin.create',['goods'=>$goods])}}" class="nav-link active">添加货品</a>
                </li>
            </ul>
        </div>
        <form action="{{route('goods.huopin.store',['goods_id'=>$id])}}" method="post">
            @csrf
            <div class="card-body">
                <div class="card">
                    <div class="card-header">
                        <h3 class="text-primary">货品添加</h3>
                    </div>
                    <div class="card-block">
                        @foreach($topAttr as $attr)
                            <div class="form-group row">
                                <label class="col-md-2 label-control text-center">{{$attr['attr_name']}}</label>
                                <div class="col-md-10">
                                    <select class="form-control" name="attrs[]" id="basicSelect">
                                        <option value="">选择{{$attr['attr_name']}}</option>
                                        @foreach($attr->attrSon as $son)
                                            <option value="{{$son['id']}}">{{$son['attr_name']}}</option>
                                        @endforeach
                                    </select>
                                </div>
                            </div>
                        @endforeach
                        <div class="form-group row">
                            <label class="col-md-2 label-control text-center">附加价格</label>
                            <div class="col-md-10">
                                <input type="text" name="fujiaPrice" class="form-control">
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-md-2 label-control text-center">库存数量</label>
                            <div class="col-md-10">
                                <input type="text" name="kucun" class="form-control">
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="card-footer text-muted">
                <button type="submit" class="btn btn-bg-gradient-x-purple-blue">保存数据</button>
            </div>
        </form>
    </div>
@endsection
